 <?php 
   
	$sql =sprintf("select tblclass.Classname,StudentName,StudentID,StudentCode,StudentPhone,StudentEmail from tblstudent inner join tblclass on tblstudent.ClassID=tblclass.classid where tblclass.ClassID='%s'",$_GET['classid']);
		


   $kq=mysql_query($sql)or die(mysql_error()); 
?>    
   
  <script type="text/javascript">
  


  function Delete()
  {	  
  var answer = confirm ("Are you want to delete It");
if (answer)
{
	document.mylist.submit();
}
  }

  function checkAll(control)
{ field= document.getElementsByName('cid[]');
if(control.checked)
{ 
	for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

else

for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}




  </script>
  
   <form name="mylist" action="User/deleteuser.php" method="post">
  	<table width="100%">
  		<tr>
  			<td colspan="4"><h3>Danh sách sinh viên</h3></td>
  			<td align="right">
  				<a  href="studenta" title="Tạo sinh viên dùng mới" style="margin-right:15px;">
   					<img src="img/Add.png" width="32" height="32" border="none"/>
   				</a>
  				<a  style="margin-right:15px;" title="Xóa sinh viên dùng đã chọn" onclick="Delete()">
  					<img src="img/delete.png" width="32" height="32"/>
  				</a>
   				
  			</td>
  		</tr>
   		<tr bgcolor="#008000" style="height:30px; color: white;">
       		<th width="21" ><input type="checkbox" name="toggle"  id="toggle" onclick=" checkAll(this);" /></th>
            <th >Mã sinh viên</th>
      		<th >Tên sinh viên</th>
      		<th >Lớp</th>
      		<th >Email</th>
      		<th>Số Điện Thoại</th>
            <th>Thực hiện</th>
    	</tr> 		 
	    <?php  $i=0;
		while($row=mysql_fetch_assoc($kq))
		{$i++;
			?>
	     <tr  bgcolor="<?php if($i%2!=0) echo '#f6f8db';else echo  '#9ff1a1'?>" onmouseover="changeback(this);" onmouseout="changebre(this);">
	         <td align="center"><input type="checkbox" name="cid[]" value="<?php echo $row['id']?>" /></td>
             <td ><?php echo $row['StudentCode'];?></td>
	         <td ><?php echo $row['StudentName'];?></td>
	         <td ><?php echo $row['Classname'];?></td>
	         <td ><?php echo $row['StudentEmail'];?></td>      
	         <td ><?php echo $row['StudentPhone']?></td>
               <td>
    	<a href="studente&id=<?php echo $row['StudentID']?>">Edit/Detail</a>&nbsp;|&nbsp;<a href="" onclick="Delete(<?php echo $row->id?>);return false;">Delete</a></td>
	     </tr>
        
	    <?php
		}
		?>
 		</table>
      </form> 
   

